import Api from './api'
import {openid} from './URL'


/**
 * @param{{查询用户信息}}
 */
let selectInfo = async () => {
    return await Api.http({url: "/user/CheckUserInfo", method: "POST", re: {openid:openid}})
};//查询自己的用户信息
let getlogin =async () => {
    return await Api.http({url: "/user/getlogin", method: "GET", re: {}})
};//查询所有用户信息
let selUserPage =async (data) => {
    return await Api.http({url: "/user/selUserPage", method: "POST", re: data})
};//分页查询用户信息
let setUpdataUser =async (data) => {
    return await Api.http({url: "/user/setInfo", method: "POST", re: data})
};//修改用户信息

export {selectInfo,getlogin,selUserPage,setUpdataUser}

/**
 * @param{{查询所有权限}}
 */
let selsPrivileges = async () => {
    return await Api.http({url: "/Privileges/sels", method: "GET", re: {}})
};//查询所有权限信息
let addPrivileges = async (data) => {
    return await Api.http({url: "/Privileges/add", method: "POST", re: data})
};//查询所有权限信息
export {selsPrivileges,addPrivileges}


/**
 * @param{{首页获取数据模块}}（官网）
 */

let selItem = async () => {
    return await Api.http({url: "/list/selItem", method: "GET", re: {}})
};//查询所有站点数据（官网）
let purview = async () => {
    return await Api.http({url: "/user/purview", method: "POST", re: {purview:'admin'}})
};//关于我们（官网）
let addItemList = async (data) => {
    return await Api.http({url: "/list/addItem", method: "POST", re: data})
};//新增站点（官网）
let delItemList = async (data) => {
    return await Api.http({url: "/list/delItem", method: "POST", re: data})
};//删除站点数据（官网）
let setItemList = async (data) => {
    return await Api.http({url: "/list/setItem", method: "POST", re: data})
};//修改站点数据（官网）
let addCate = async (data) => {
    return await Api.http({url: "/list/addCate", method: "POST", re: data})
};//新增站点分类（官网）
let setCate = async (data) => {
    return await Api.http({url: "/list/setCate", method: "POST", re: data})
};//修改站点分类（官网）

export {purview,selItem,addItemList,delItemList,setItemList,addCate,setCate}

/**
 * @param{{登录模块}}
 */

let login=async (data) => {
    return await Api.http({url: '/user/PostLogin', method: 'POST',re: data})
};//登录
let relogin=async (data) => {
    return await Api.http({url: '/user/PostReg', method: 'POST', re: data})
};//注册
let reCode=async (data) => {
    return await Api.http({url: '/code/YzCode', method: 'POST', re: data})
};//验证码校验
let checklogin=async (data) => {
    return await Api.http({url: '/user/checklogin', method: 'POST', re: data})
};//自动登录校验
let deletCode=async (data) => {
    return await Api.http({url: '/code/DeletCode', method: 'GET', re: data})
};//验证码校验

export {login,relogin,reCode,checklogin,deletCode}

/**
 * @param {{邮箱登录模块}}
 */

let  sendEmail=async (data) =>{
    return await Api.http({url: '/email/send', method: 'POST', re: data})
};//发送邮箱
let  loginEmail=async (data) => {
    return await Api.http({url: '/email/login', method: 'POST', re: data})
};//忘记密码

export {sendEmail,loginEmail}

/**
 * @param{{软件市场文件模块}}
 */

let addSoft=async (data) => {
    return await Api.http({url: "/software/addSoft", method: "POST", re: data})
} ;//添加软件商品
let delSoft=async (data) => {
    return await Api.http({url: "/software/delSoft", method: "POST", re: data})
} ;//删除软件商品
let setSoft=async (data) => {
    return await Api.http({url: "/software/setSoft", method: "POST", re: data})
} ;//修改软件商品
let selSoft=async (data) => {
    return await Api.http({url: "/software/selSoft", method: "POST", re: data})
} ;//查询软件商品（单条）
let selSoftGet=async () => {
    return await Api.http({url: "/software/selSoftGet", method: "GET", re: {}})
} ;//查询软件商品（全部）

export { addSoft,delSoft,setSoft,selSoft,selSoftGet}


/**
 * @param{{头像模块}}
 */
let deleteimg=async (data) => {
    return await Api.http({url: "/upload/deleteimg", method: "POST", re: data})
} ;//删除服务器图片
let Avatar=async (data) => {
    return await Api.http({url: "/user/avatar", method: "POST", re: data})
} ;//上传头像

export {deleteimg,Avatar}


/**
 * @param{{商品模块和支付模块}}
 */

let addPayOrders=async (data) => {
    return await Api.http({url: "/payOrders/addOrders", method: "POST", re: data})
} ;//添加订单
let delPayOdersDao=async (data)=>{
    return await Api.http({url: "/payOrders/delPayOdersDao", method: "POST", re: data})
}//删除订单
let addShopping=async (data) => {
    return await Api.http({url: "/payOrders/addShopping", method: "POST", re: data})
} ;//添加商品
let delShopping=async (data) => {
    return await Api.http({url: "/payOrders/delShopping", method: "POST", re: data})
} ;//删除商品
let pay=async (data) => {
    return await Api.http({url: "/alipay/pay", method: "POST", re: data})
} ;//发起支付

let selAdminOders=async (data) => {
    return await Api.http({url: "/payOrders/selAdminOders", method: "POST", re: data})
} ;//查询用户个人所有订单


export {addPayOrders,addShopping,delShopping,pay,selAdminOders,delPayOdersDao}



/**
 * @param{{查询坐标点信息}}
 */
let selCoordinate=async () => {
    return await Api.http({url: "/user/coordinate", method: "GET", re: {}})
} ;//添加订单

export {selCoordinate}





